const languageKey = 'language'
const tokenKey = 'X-Token'

class LocalStorageStatic {
  getLanguage () {
    return this.localGetItem(languageKey)
  }

  setLanguage (value: string) {
    return this.localSetItem(languageKey, value)
  }

  getToken () {
    return this.sessionGetItem(tokenKey)
  }

  setToken (value: string) {
    return this.sessionSetItem(tokenKey, value)
  }

  removeToken () {
    return this.sessionRemoveItem(tokenKey)
  }

  localGetItem (key: string) {
    return localStorage.getItem(`${process.env.VUE_APP_APP}-${key}`)
  }

  localRemoveItem (key: string) {
    localStorage.removeItem(`${process.env.VUE_APP_APP}-${key}`)
  }

  localSetItem (key: string, value: string) {
    return localStorage.setItem(`${process.env.VUE_APP_APP}-${key}`, value)
  }

  sessionGetItem (key: string) {
    // console.log(key);
    return sessionStorage.getItem(`${process.env.VUE_APP_APP}-${key}`)
  }

  sessionRemoveItem (key: string) {
    sessionStorage.removeItem(`${process.env.VUE_APP_APP}-${key}`)
  }

  sessionSetItem (key: string, value: string) {
    return sessionStorage.setItem(`${process.env.VUE_APP_APP}-${key}`, value)
  }
}

export const LocalStorage = new LocalStorageStatic()
